
import actions from './actions'
import getters from './getters'
import mutations from './mutations'

import auth from '@/utils/auth'

const state = {
  token: auth.getLocalStorage('CMS-TOKEN'),
  current_user: auth.getLocalStorage('CMS-USER'),
}

const user = {
  state,
  getters,
  actions,
  mutations
}

if (module.hot) {
  module.hot.accept([
    './actions',
    './getters',
    './mutations'
  ], () => {
    user.hotUpdate({
      actions: require('./actions'),
      getters: require('./getters'),
      mutations: require('./mutations')
    })
  })
}

export default user